package com.print;

import java.applet.Applet;

import javax.print.PrintService;
import javax.print.PrintServiceLookup;

public class PrinterApplet extends Applet {

    private static final long serialVersionUID = 750659524722881059L;

    public String findAllPrinters() {
        PrintService[] services = PrintServiceLookup.lookupPrintServices(null, null);
        StringBuilder sb = new StringBuilder();
        sb.append("[");
        for (int i = 0; services != null && i < services.length; i++) {
            sb.append("'").append(services[i].getName()).append("',");
        }
        if (sb.length() > 1) {
            sb.deleteCharAt(sb.length() - 1);
        }
        sb.append("]");
        return sb.toString();
    }

}
